<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>后台登录</title>
<link rel="stylesheet" type="text/css" href="layui/css/layui.css" />
<link rel="stylesheet" type="text/css" href="static/admin/css/login.css" />
<script src="js/jquery-2.0.3.js" type="text/javascript" charset="utf-8"></script>
<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>

</head>
<body>
<div class="m-login-bg">
		<div class="m-login">
			<h3>后台商家注册</h3>
			<div class="m-login-warp">
				<form class="layui-form" action="AdminLoginServlet" method="post">
					<div class="layui-form-item">
						请输入用户名：<input type="text" id="adminname" name="adminname" required
							lay-verify="required|adminname" placeholder="用户名"
							autocomplete="off" class="layui-input">
					</div>
					<div class="layui-form-item">
						请输入用户密码：<input type="password" id="adminpwd" name="adminpwd" required
							lay-verify="required|adminpwd" placeholder="密码" autocomplete="off"
							class="layui-input">
					</div>
					<div class="layui-form-item">
						确认输入用户密码：<input type="password" id="readminpwd" name="readminpwd" required
							lay-verify="required|readminpwd" placeholder="密码" autocomplete="off"
							class="layui-input">
					</div>
					<div class="layui-form-item m-login-btn">
						<div class="layui-inline">
							<button class="layui-btn layui-btn-normal" lay-submit=""
								lay-filter="login">注册</button>
							<input type="hidden" id="op" name="op" value="add">
						</div>
						<div class="layui-inline">
							<button type="reset" class="layui-btn layui-btn-primary">取消</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>


	<script>
		layui.use([ 'form', 'layer' ], function() {
			var form = layui.form;
			var layer = layui.layer;

			//自定义验证规则
			form.verify({
				adminname : function(value, item) {
					//value：表单的值、item：表单的DOM对象
					if (!new RegExp("^(.+){4,18}$").test(value)) {
						return '用户名长度必须为4-18位'
					}
					if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$")
							.test(value)) {
						return '用户名不能有特殊字符';
					}
					if (/(^\_)|(\__)|(\_+$)/.test(value)) {
						return '用户名首尾不能出现下划线\'_\'';
					}
					if (/^\d+\d+\d$/.test(value)) {
						return '用户名不能全为数字';
					}
				},
				password : [ /^[\S]{6,18}$/, '密码必须6到12位，且不能出现空格' ],
				verity : [ /(.+){6}$/, '验证码必须是6位' ],

			});
		});
		
	</script>
</body>
</html>